﻿/* 2011/8/1 */
using System;
using System.Collections.Generic;
using System.Text;

namespace PictureManager
{
    /// <summary>
    /// Selection of parts of border will be hidden. 
    /// </summary>
    class HideBorderSelection
    {
        private const int _NONE = 0x0000;
        
        private const int _MAIN_MENU = 0x0001;
        private const int _MAIN_STATUS = 0x0002;

        private const int _FOLDER_TREE = 0x0010;
        private const int _FILE_BASKET = 0x0020;
        
        private const int _FILE_TOOL = 0x0100;
        private const int _IMAGE_TOOL = 0x0200;
        private const int _RENAME_TOOL = 0x0400;
        private const int _SEARCH_TOOL = 0x0800;

        private const int _PAGE_TAB = 0x1000;

        int _escapeNumber;

        /// <summary>
        /// Initialize a instance of HideBorderSelection by escape number.
        /// </summary>
        /// <param name="escapeNumber">The escape number.</param>
        public HideBorderSelection(int escapeNumber)
        {
            _escapeNumber = escapeNumber;
        }

        /// <summary>
        /// Initialize a instance of HideBorderSelection by selecting every part.
        /// </summary>
        /// <param name="mainMenu"></param>
        /// <param name="mainStatus"></param>
        /// <param name="fileTool"></param>
        /// <param name="imageTool"></param>
        /// <param name="renameTool"></param>
        /// <param name="researchTool"></param>
        /// <param name="folderTree"></param>
        /// <param name="fileBasket"></param>
        public HideBorderSelection(bool mainMenu, bool mainStatus, bool folderTree, bool fileBasket, bool fileTool, bool imageTool, bool renameTool, bool searchTool, bool pageTab)
        {
            _escapeNumber = _NONE;

            if (mainMenu)
                _escapeNumber |= _MAIN_MENU;

            if (mainStatus)
                _escapeNumber |= _MAIN_STATUS;

            if (folderTree)
                _escapeNumber |= _FOLDER_TREE;

            if (fileBasket)
                _escapeNumber |= _FILE_BASKET;

            if (fileTool)
                _escapeNumber |= _FILE_TOOL;

            if (imageTool)
                _escapeNumber |= _IMAGE_TOOL;

            if (renameTool)
                _escapeNumber |= _RENAME_TOOL;

            if (searchTool)
                _escapeNumber |= _SEARCH_TOOL;

            if (pageTab)
                _escapeNumber |= _PAGE_TAB;
        }

        public int EscapeNumber
        {
            get { return _escapeNumber; }
        }

        public bool MainMenu
        {
            get { return (_escapeNumber & _MAIN_MENU) != _NONE; }
        }

        public bool MainStatus
        {
            get { return (_escapeNumber & _MAIN_STATUS) != _NONE; }
        }

        public bool FolderTree
        {
            get { return (_escapeNumber & _FOLDER_TREE) != _NONE; }
        }

        public bool FileBasket
        {
            get { return (_escapeNumber & _FILE_BASKET) != _NONE; }
        }

        public bool FileTool
        {
            get { return (_escapeNumber & _FILE_TOOL) != _NONE; }
        }

        public bool ImageTool
        {
            get { return (_escapeNumber & _IMAGE_TOOL) != _NONE; }
        }

        public bool RenameTool
        {
            get { return (_escapeNumber & _RENAME_TOOL) != _NONE; }
        }

        public bool SearchTool
        {
            get { return (_escapeNumber & _SEARCH_TOOL) != _NONE; }
        }

        public bool PageTab
        {
            get { return (_escapeNumber & _PAGE_TAB) != _NONE; }
        }
    }
}
